<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>供应商列表</title>
    <link rel="stylesheet" href="/adminthemes/layui/css/layui.css" media="all">
    <!-- jQuery -->
    <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<br>
<br>
<div class="demoTable" style="margin-left: 5%">
    供应商名称：
    <div class="layui-inline">
        <input class="layui-input" name="id" id="demoReload" autocomplete="off">
    </div>
    <button class="layui-btn" data-type="reload">搜索</button>
</div>
<table id="demo"  lay-data="{id:'demo'}" lay-filter="test" style="margin-left: 20%;margin-right: 20%"></table>
</body>
<script src="/adminthemes/layui/layui.js"></script>
<script>
    layui.use('table', function(){
        var table = layui.table;
        //第一个实例
        table.render({
            elem: '#demo'
            ,height: 315
            ,limit:10
            ,id:"rbt"
            ,request: {
                pageName: 'page' //页码的参数名称，默认：page
                ,limitName: 'limit'//每页数据量的参数名，默认：limit
            }
            ,url: '/web/supplier/getsupplierlist.do' //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'supplier_name', title: '供应商名称', width:150, fixed: 'left'}
                ,{field: 'supplier_user', title: '供应商联系人', width:150}
                ,{field: 'mobile', title: '供应商登录手机号', width:150}
                ,{field: 'password', title: '供应商登录密码', width:150}
                ,{field: 'supplier_address', title: '供应商联系地址', width: 150}
                ,{field: 'bussiness_scope', title: '供应商经营范围', width: 150}
             //   ,{field: 'caozuo', title: '操作', width: 150,toolbar: '#barDemo'}
//                ,{field: 'score', title: '评分', width: 80, sort: true}
//                ,{field: 'classify', title: '职业', width: 80}toolbar: '#barDemo'
//                ,{field: 'wealth', title: '财富', width: 135, sort: true}
            ]]
        });


        var $ = layui.$, active = {
            reload: function(){
                var demoReload = $('#demoReload').val();
                //执行重载
                table.reload('rbt', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                        seacher: demoReload
                    }
                });
            }
        };

        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        table.on('tool(test)', function(obj){
            var data = obj.data;
            if(obj.event === 'detail'){
               // layer.msg('ID：'+ data.id + ' 的查看操作');
                layer.open({
                    type: 2,
                    area: ['830px', '420px'],
                    title: '',
                    content: '.do?id='+data.id,
                })
            }
        });
    });
</script>
<!--<script type="text/html" id="barDemo">-->
    <!--<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>-->
<!--</script>-->
</body>
</html>